home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 001 / pibt40s6.arc / UPDATERE.MOD < prev    next >
Text File  |  1987-09-08  |  1KB  |  49 lines

  1. (*----------------------------------------------------------------------*)
  2. (*          Update_Review_Pointers --- Update review buffer pointers    *)
  3. (*----------------------------------------------------------------------*)
  4.  
  5. PROCEDURE Update_Review_Pointers;
  6.  
  7. VAR
  8.    L: INTEGER;
  9.    I: INTEGER;
  10.  
  11. BEGIN (* Update_Review_Pointers *)
  12.  
  13.                                    (* Append CR/LF as needed *)
  14.  
  15.    L                := MIN( ORD( Review_Line[0] ) , Max_Review_Line_Length );
  16.    Review_Line[L+1] := CHR( CR );
  17.    Review_Line[L+2] := CHR( LF );
  18.    L                := L + 2;
  19.    Review_Line[0]   := CHR( L  );
  20.  
  21.    FOR I := 1 TO L DO
  22.       BEGIN
  23.                                    (* Increment capture pointer           *)
  24.  
  25.          Review_Head := SUCC( Review_Head );
  26.  
  27.          IF Review_Head > Max_Review_Length THEN
  28.             Review_Head := 1;
  29.                                    (* If we wrapped into last char,       *)
  30.                                    (* update last char pointer            *)
  31.  
  32.          IF Review_Head = Review_Tail THEN
  33.             BEGIN
  34.                Review_Tail := SUCC( Review_Tail );
  35.                IF Review_Tail > Max_Review_Length THEN
  36.                   Review_Tail := 1;
  37.             END;
  38.  
  39.          IF Review_Tail = 0 THEN
  40.             Review_Tail := 1;
  41.  
  42.          Review_Buffer^[Review_Head] := Review_Line[I];
  43.  
  44.       END;
  45.  
  46.    Review_Line[0] := #0;
  47.  
  48. END   (* Update_Review_Pointers *);
  49.